﻿<Window x:Class="CPPEI.Coolzon.UI.XProperty.Editors.ImageSourceFileArrayEditWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:CPPEI.Coolzon.UI.XProperty.Editors"
        xmlns:runtime="clr-namespace:CPPEI.Coolzon.Designtime"
        mc:Ignorable="d"
        Title="多张图片选择" Height="600" Width="360" Topmost="True" ShowInTaskbar="False" WindowStartupLocation="CenterScreen" Loaded="Window_Loaded"
        Style="{DynamicResource WindowStyle}">
    <Window.Resources>
        <ObjectDataProvider x:Key="ResGetImageResList" ObjectType="{x:Type local:ImageSourceFileArrayEditWindow}" MethodName="GetImageRes"/>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="35"/>
        </Grid.RowDefinitions>
        <StackPanel Style="{DynamicResource ButtonPanelBackground}" Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Right" Width="291">
            <Button x:Name="_ctlAdd" Style="{DynamicResource AddButtonStyle}" FontSize="15" Width="36" Margin="3" ToolTip="增加" Click="_ctlAdd_Click"/>
            <Button x:Name="_ctlRemove" Style="{DynamicResource RemoveButtonStyle}" FontSize="15" Width="36" Margin="3" ToolTip="删除" Click="_ctlRemove_Click"/>
            <Button Name="_ctlUp" Style="{DynamicResource UpButtonStyle}" FontSize="15" Width="36" Margin="3" ToolTip="上移" Click="_ctlUp_Click"/>
            <Button Name="_ctlDown" Style="{DynamicResource DownButtonStyle}" FontSize="15" Width="36" Margin="3" ToolTip="下移" Click="_ctlDown_Click"/>
        </StackPanel>
        <ListView x:Name="_ctlLV" Grid.Row="1" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
            <ListView.ItemTemplate>
                <DataTemplate DataType="{x:Type local:ImageSourceArrayModel}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <ComboBox Grid.Column="0" MinWidth="120" Height="25" Margin="3" ItemsSource="{Binding Source={StaticResource ResGetImageResList}}"  SelectedItem="{Binding ImageRes, Mode=TwoWay}" GotFocus="Element_GotFocus" >
                            <ComboBox.ItemTemplate>
                                <HierarchicalDataTemplate DataType="{x:Type runtime:ImageRes}" >
                                    <TextBlock Text="{Binding Name}"/>
                                </HierarchicalDataTemplate>
                            </ComboBox.ItemTemplate>
                        </ComboBox>
                        <Image Grid.Column="1" Source="{Binding ImageSource}" MaxHeight="50" GotFocus="Element_GotFocus"  />
                    </Grid>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
        <Grid Grid.Row="2">
            <StackPanel Margin="5" Orientation="Horizontal" HorizontalAlignment="Center">
                <Button Style="{DynamicResource  SubmitOrCancelButtonStyle}" Content="确定" Margin="0,0,20,0" Click="Button_Click" Width="75" />
                <Button Style="{DynamicResource  SubmitOrCancelButtonStyle}" Name="cancel" Content="取消" Margin="20,0,0,0" Click="cancel_Click" Width="75"></Button>
            </StackPanel>
        </Grid>
    </Grid>
</Window>
